package com.chixing.ih.module.programmer.mapper;

import com.chixing.ih.common.IhRepository;
import com.chixing.ih.module.programmer.mapper.provider.PersonalSkillMapperProvider;
import com.chixing.ih.module.programmer.pojo.PersonalSkill;
import com.chixing.ih.module.programmer.pojo.dto.PersonalSkillDTO;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘岩
 * Date: 2020-09-29
 * Time: 16:45
 *
 * @version 1.0
 */
@Mapper
public interface PersonalSkillMapper extends IhRepository<PersonalSkill> {

    @UpdateProvider(type = PersonalSkillMapperProvider.class, method = "updateOne")
    int updateOne(PersonalSkill personalSkill);

    @SelectProvider(type = PersonalSkillMapperProvider.class, method = "listAll")
    @Results(id = "personalSkillMap", value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "skill_name", property = "skillName"),
            @Result(column = "skill_score", property = "skillScore"),
            @Result(column = "create_time", property = "createTime"),
            @Result(column = "update_time", property = "updateTime"),

    })
    PersonalSkill getOne(long personalSkillId);

    @InsertProvider(type = PersonalSkillMapperProvider.class, method = "insertOne")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int insertOne(PersonalSkillDTO personalSkillDTO);

    @DeleteProvider(type = PersonalSkillMapperProvider.class, method = "deleteOneById")
    int deleteOne(long id);


    @SelectProvider(type = PersonalSkillMapperProvider.class, method = "getSkillId")
    List<Long> getPersonalSkillId(long userId);



    @InsertProvider(type = PersonalSkillMapperProvider.class, method = "insert")
    int insert(PersonalSkillDTO personalSkillDTO);

    @SelectProvider(type = PersonalSkillMapperProvider.class, method = "getSkillName")
    List<String>getSkillName(long userId);
}
